<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        //边界符：限定边界
        // 1.开头:^,以什么作为开头
        var reg = /^ab{2}\d+/;
        var str = "abb123456";
        console.log(reg.test(str));
        //2.结尾：$:以什么作为结尾
        var reg = /^a\w+\$$/;
        var str = "abbb$";
        console.log(reg.test(str));
        //3.边界符\b
        // 边界 ：正则里的边界 是 非\w  ; \W
        var reg = /\bis\b/;
        var str = "asdg is afsdgf";
        console.log(reg.test(str));
        var className = "active containerbox";
        var reg = /\bbox\b/;
        if (reg.test(className)) {
            console.log("有这个类名");
        } else {
            console.log("没有类名");
        }
    </script>
</body>

</html>